﻿using BigEgg.Framework.Foundation;
using BigEgg.Framework.UnitTesting;
using FMStudio.Domain.Properties;
using FMStudio.Domain.Test.MockClasses;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Globalization;

namespace FMStudio.Domain.Test
{
    [TestClass]
    public class MarketTest
    {
        [TestMethod]
        public void MarketNameValidationTest()
        {
            MockMarket market = new MockMarket();

            Assert.IsNull(market.Name);
            Assert.AreEqual(Resources.MarketNameMandatory, market.Validate("Name"));

            market.Name = TestHelper.CreateString('A', 99);
            Assert.AreEqual("", market.Validate("Name"));
            market.Name = TestHelper.CreateString('A', 100);
            Assert.AreEqual("", market.Validate("Name"));
            market.Name = TestHelper.CreateString('A', 101);
            Assert.AreEqual(
                string.Format(CultureInfo.CurrentCulture, Resources.MarketNameMaxLength, "Name", 100)
                , market.Validate("Name"));
        }
    }
}
